package org.his.utils;

import java.io.Serializable;

public class ResponseResult<T> implements Serializable {

        private long count;
        private T data;
        private int code;
        private String msg;

        public long getCount() {
            return count;
        }

        public void setCount(long count) {
            this.count = count;
        }

        public T getData() {
            return data;
        }

        public void setData(T data) {
            this.data = data;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public ResponseResult(long count, T data, int code, String msg) {
            this.count = count;
            this.data = data;
            this.code = code;
            this.msg = msg;
        }

        public ResponseResult(long count, T data) {
            this.count = count;
            this.data = data;
            this.code = 0;
            this.msg = "";
        }

        public ResponseResult(int code, String msg) {
            this.code = code;
            this.msg = msg;
        }
         public ResponseResult(T data) {
            this.data = data;
            this.code = 0;
            this.msg = "";
        }

        /**
         * 成功方法
         * @return
         */
        public static ResponseResult createSuccessResult(){

            return new ResponseResult(0,"");
            }

            public static  ResponseResult error(){
                return new ResponseResult(1,"失败");
            }
}
